<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>输入数字，输出几位数</title>
</head>

<body>
</body>
</html>
<script>
	function countnum(num){
		var arr = []
		while(num){
			arr.push(num%10)
			num = parseInt(num/10)
		}
		arr.reverse();
		alert("这是一个"+arr.length+"位数"+".每位分别为:"+arr)
	}
	countnum(1234)
</script>